<?php 
header("Content-type: text/html; charset=utf-8"); 

$conn=@mysql_connect('localhost','root','')
   Or die('数据库无法连接！');
@mysql_select_db('neu-video',$conn)
Or die('数据库不存在！');
mysql_set_charset('utf8');
$sql2='select * from videos left join videotype on videos.tid=videotype.tid';
$result2=mysql_query($sql2,$conn);
 $videos=fetch_array($result2);

  echo '<table border="1">';
   echo '<caption>视频列表</caption>';
  echo '<tr><th>视频编号</th><th>视频名称</th><th>类型编号</th><th>类型名称</th><th>海报</th><th>内容简介</th><th>添加日期</th><th>上传用户</th><th>点击率</th><th>下载量</th><th>下载地址</th></tr>';
 foreach ($videos as $one) {
    echo '<tr>';
 	echo '<td>'.$one['vid'].'</td>';
 	echo '<td>'.$one['videoname'].'</td>';
 	echo '<td>'.$one['tid'].'</td>';
 	echo '<td>'.$one['typename'].'</td>';
    echo '<td>'.$one['pic'].'</td>';
    echo '<td>'.$one['intro'].'</td>';
    echo '<td>'.$one['uploaddate'].'</td>';
    echo '<td>'.$one['uploadadmin'].'</td>';
    echo '<td>'.$one['hittimes'].'</td>';
    echo '<td>'.$one['downtimes'].'</td>';
    echo '<td>'.$one['address'].'</td>';
 	echo '</tr>';
 }
 echo '</table>';




function fetch_array($results){
   $arrs=array();
   while($results && ($row=mysql_fetch_assoc($results))!==FALSE)
{
     $arrs[]=$row;
}
	return $arrs;
}
 ?>